import store from './store'

const TokenKey = 'admin-Token'

export function getToken () {
  return store.get(TokenKey)
}

export function setToken (token) {
  return store.set(TokenKey, token, new Date().getTime() + (24 * 60 * 60 * 1000))
}

export function removeToken () {
  return store.remove(TokenKey)
}

export function setData (obj) {

  var params=new URLSearchParams();

  for (var key in obj){

    if (obj.hasOwnProperty(key)){
      params.append(key,obj[key]);
    }

  }

  return params;

}
